<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="theme-color" content="#33474d">
	<title>使用jenkins进行持续集成 | 失落的乐章</title>
	<link rel="stylesheet" href="/css/style.css" />
	
      <link rel="alternate" href="/atom.xml" title="失落的乐章" type="application/atom+xml">
    
</head>

<body>

	<header class="header">
		<nav class="header__nav">
			
				<a href="/archives" class="header__link">Archive</a>
			
				<a href="/tags" class="header__link">Tags</a>
			
				<a href="/atom.xml" class="header__link">RSS</a>
			
		</nav>
		<h1 class="header__title"><a href="/">失落的乐章</a></h1>
		<h2 class="header__subtitle">技术面前，永远都是学生。</h2>
	</header>

	<main>
		<article>
	
		<h1>使用jenkins进行持续集成</h1>
	
	<div class="article__infos">
		<span class="article__date">2017-10-12</span><br />
		
		
			<span class="article__tags">
			  	<a class="article__tag-link" href="/tags/Jenkins/">Jenkins</a>
			</span>
		
	</div>

	

	
		<h2 id="安装JDK"><a href="#安装JDK" class="headerlink" title="安装JDK"></a>安装JDK</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;因为jenkins需要java环境，需要提前安装JDK。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下载JDK后解压</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># tar zxvf jdk-8u111-linux-x64.tar.gz</span></div><div class="line">[root@localhost ~]<span class="comment"># mv jdk1.8.0_111/ /usr/local/</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编辑文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># vim /etc/profile.d/java.sh</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;加入配置</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">JAVA_HOME=/usr/<span class="built_in">local</span>/jdk1.8.0_111/</div><div class="line">JAVA_BIN=/usr/<span class="built_in">local</span>/jdk1.8.0_111/bin</div><div class="line">JRE_HOME=/usr/<span class="built_in">local</span>/jdk1.8.0_111/jre</div><div class="line">PATH=<span class="variable">$PATH</span>:/usr/<span class="built_in">local</span>/jdk1.8.0_111/bin:/usr/<span class="built_in">local</span>/jdk1.8.0_111/jre/bin</div><div class="line">CLASSPATH=/usr/<span class="built_in">local</span>/jdk1.8.0_111/jre/lib:/usr/<span class="built_in">local</span>/jdk1.8.0_111/lib:/usr/<span class="built_in">local</span>/jdk1.8.0_111/jre/lib/charsets.jar</div><div class="line"><span class="built_in">export</span> JAVA_HOME JAVA_BIN JRE_HOME PATH CLASSPATH</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然后进入初始化环境变量</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># source /etc/profile.d/java.sh</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果JDK配置成功，下面的名利个可以看到java版本</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># java -version</span></div><div class="line">java version <span class="string">"1.8.0_111"</span></div><div class="line">Java(TM) SE Runtime Environment (build 1.8.0_111-b14)</div><div class="line">Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)</div></pre></td></tr></table></figure>
<h2 id="下载安装jenkins"><a href="#下载安装jenkins" class="headerlink" title="下载安装jenkins"></a>下载安装jenkins</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;首先，从<a href="https://jenkins.io" target="_blank" rel="external">jenkins官方网站</a>下载最新的包。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;选择Red Hat/CentOS，可以根据官网提示安装</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/01.png?raw=true" alt="01"><figcaption class="figure__caption">01</figcaption></figure></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo</div><div class="line">rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key</div><div class="line">yum install jenkins</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;也可以下载相应的rpm包进行安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># rpm -ivh jenkins-2.78-1.1.noarch.rpm </span></div><div class="line">警告：jenkins-2.78-1.1.noarch.rpm: 头V4 DSA/SHA1 Signature, 密钥 ID d50582e6: NOKEY</div><div class="line">准备中...                                                            (<span class="comment">################################# [100%]</span></div><div class="line">正在升级/安装...</div><div class="line">   1:jenkins-2.78-1.1                                                 <span class="comment">################################# [100%]</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;另外也可以下载war包，只需要运行命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># java -jar jenkins.war</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;jenkins就启动成功了！war包自带jetty服务器，剩下的工作全部在浏览器中进行。</p>
<h2 id="防火墙设置"><a href="#防火墙设置" class="headerlink" title="防火墙设置"></a>防火墙设置</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># systemctl stop firewalld</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;或者</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">firewall-cmd –zone=public –add-port=8080/tcp –permanent </div><div class="line">firewall-cmd –zone=public –add-service=http –permanent </div><div class="line">firewall-cmd –reload</div></pre></td></tr></table></figure>
<h2 id="启动jenkins服务"><a href="#启动jenkins服务" class="headerlink" title="启动jenkins服务"></a>启动jenkins服务</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;启动jenkins服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># /etc/init.d/jenkins start</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;启动失败</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># /etc/init.d/jenkins start</span></div><div class="line">Starting jenkins (via systemctl):  Job <span class="keyword">for</span> jenkins.service failed because the control process exited with error code. See <span class="string">"systemctl status jenkins.service"</span> and <span class="string">"journalctl -xe"</span> <span class="keyword">for</span> details.</div><div class="line">                                                           [失败]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;出错原因是jdk未安装或jenkins配置文件中没有找到jdk的路径</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;解决办法是安装jdk，修改jenkins启动脚本,配置jdk位置</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># vim /etc/init.d/jenkins</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;添加内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">/usr/<span class="built_in">local</span>/jdk1.8.0_111/bin/java</div></pre></td></tr></table></figure>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/02.png?raw=true" alt="02"><figcaption class="figure__caption">02</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果错误提示</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># /etc/init.d/jenkins start</span></div><div class="line">Starting jenkins (via systemctl):  Warning: jenkins.service changed on disk. Run <span class="string">'systemctl daemon-reload'</span> to reload units.</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用命令解决</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># systemctl daemon-reload</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;再次启动jenkins</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># /etc/init.d/jenkins restart</span></div><div class="line">Restarting jenkins (via systemctl):                        [  确定  ]</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;查看是否启动</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># netstat -natpu|grep 8080</span></div><div class="line">tcp6       0      0 :::8080                 :::*                    LISTEN      5041/java</div></pre></td></tr></table></figure>
<h2 id="访问jenkins"><a href="#访问jenkins" class="headerlink" title="访问jenkins"></a>访问jenkins</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在浏览器中输入 <a href="http://ip:8080" target="_blank" rel="external">http://ip:8080</a></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果安装完成并成功启动会有下图</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/03.png?raw=true" alt="03"><figcaption class="figure__caption">03</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;第一次启动jenkins时，出于安全考虑，jenkins会自动生成一个随机的密码。查看/var/lib/jenkins/secrets/initialAdminPassword这个文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cat /var/lib/jenkins/secrets/initialAdminPassword</span></div><div class="line">2bdb5321eac84842b6e37a08758d3654</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;将密码复制出来，粘贴，继续进入配置页面</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/04.png?raw=true" alt="04"><figcaption class="figure__caption">04</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这里可以根据自己需求选择推荐插件或者自己选择插件安装。如果执行默认的安装，jenkins就自动配置好Maven、git等常用插件。</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/05.png?raw=true" alt="05"><figcaption class="figure__caption">05</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;最后，创建一个admin用户，完成安装。</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/06.png?raw=true" alt="06"><figcaption class="figure__caption">06</figcaption></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/07.png?raw=true" alt="07"><figcaption class="figure__caption">07</figcaption></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/08.png?raw=true" alt="08"><figcaption class="figure__caption">08</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;用管理员账号登录Jenkins后，第一次使用前，需要在“系统管理”-&gt;“Global Tool Configuration”-&gt;“Maven”中新增一个Maven，直接输入一个名字，选中“自动安装”，Jenkins会自动下载并安装Maven</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/09.png?raw=true" alt="09"><figcaption class="figure__caption">09</figcaption></figure></p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/10.png?raw=true" alt="10"><figcaption class="figure__caption">10</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果不成功就在“管理插件”里边选择“可选插件”，安装<code>Maven Integration plugin</code>。</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/11.png?raw=true" alt="11"><figcaption class="figure__caption">11</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然后，在Jenkins首页选择“新建”，输入名字，选择“构建一个maven项目”</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/12.png?raw=true" alt="12"><figcaption class="figure__caption">12</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在配置页中，源码管理选择Git，填入地址</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/13.png?raw=true" alt="13"><figcaption class="figure__caption">13</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;默认使用master分支。如果需要口令，在Credentials中添加用户名/口令，或者使用SSH Key。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;构建触发器指定了触发一次构建的条件。推荐使用最简单的配置“Poll SCM”，它的意思是，定时检查版本库，发现有新的提交就触发构建。这种方式对git、SVN等所有版本管理系统都是通用的。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在日程表中填入</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">* * * * *</div></pre></td></tr></table></figure>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/14.png?raw=true" alt="14"><figcaption class="figure__caption">14</figcaption></figure></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;表示每分钟检查一次。如果觉得太频繁，可以该成“每3分钟检查一次”</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">*/3 * * * *</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在“Build”中，默认的Root POM是<code>pom.xml</code>。如果<code>pom.xml</code>不在根目录下，就填入子目录，例如：<code>wxapi/pom.xml</code>。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在Goals and options中，填入需要执行的mvn命令：<code>clean package</code>，Jenkins将执行如下命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mvn clean package</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;特殊参数也在这里填写，如<code>-DskipTests=true clean package</code>。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;保存后，就可以执行自动化构建了。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;点击一个构建任务，可以在Console Output中看到控制台详细输出，便于出错排查</p>
<p><figure class="figure"><img src="https://github.com/hcldirgit/image/blob/master/jenkins%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD%E5%BA%94%E7%94%A8%E4%BB%A3%E7%A0%81/15.png?raw=true" alt="15"><figcaption class="figure__caption">15</figcaption></figure></p>
<h2 id="如何部署"><a href="#如何部署" class="headerlink" title="如何部署"></a>如何部署</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果要部署构建好的war包，可以在Post Steps中填上shell命令，直接用脚本部署。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;另一种方式是创建另外一个构建项目，手动触发部署。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;无论用哪种方式，都是为了确保编译、部署是通过CI服务器完成的，而不是某台开发机器。</p>
<h2 id="如何创建Linux服务"><a href="#如何创建Linux服务" class="headerlink" title="如何创建Linux服务"></a>如何创建Linux服务</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;有了Jenkins，就可以在内网或者租用一台EC2服务器来搭建CI环境。因为不想每次登录到Linux去启动Jenkins，也不想写脚本来启动服务。推荐安装JDK后，配合supervisor，把Jenkins直接变成一个服务。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以在Linux上创建一个<code>ci</code>用户，然后，用supervisor启动并指定9001端口：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="comment"># /etc/supervisor/conf.d/ci.conf</span></div><div class="line"></div><div class="line">[program:ci]</div><div class="line"><span class="built_in">command</span>=java -jar /home/ci/jenkins.war --httpPort=9001</div><div class="line">user=ci</div><div class="line">autostart=<span class="literal">true</span></div><div class="line">autorestart=<span class="literal">true</span></div><div class="line">startsecs=30</div><div class="line">startretries=5</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Jenkins默认在当前用户的主目录下创建<code>.jenkins</code>目录，所有的配置文件、数据库都存放在里面，只需要备份这个目录就备份了整个CI配置。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;这样，一个CI环境就搭建完毕。</p>

	

	
		<span class="different-posts"><a href="/2017/10/12/jenkins/2.使用jenkins进行持续集成/" onclick="window.history.go(-1); return false;">⬅️ Go back </a></span>

	

</article>

	</main>

	<footer class="footer">
	<div class="footer-content">
		
	      <div class="footer__element">
	<p>Hi there, <br />welcome to my Blog glad you found it. Have a look around, will you?</p>
</div>

	    
	      <div class="footer__element">
	<h5>Check out</h5>
	<ul class="footer-links">
		<li class="footer-links__link"><a href="/archives">Archive</a></li>
		
		  <li class="footer-links__link"><a href="/atom.xml">RSS</a></li>
	    
		<li class="footer-links__link"><a href="/about">about page</a></li>
		<li class="footer-links__link"><a href="/tags">Tags</a></li>
		<li class="footer-links__link"><a href="/categories">Categories</a></li>
	</ul>
</div>

	    

		<div class="footer-credit">
			<span>© 2017 失落的乐章 | Powered by <a href="https://hexo.io/">Hexo</a> | Theme <a href="https://github.com/HoverBaum/meilidu-hexo">MeiliDu</a></span>
		</div>

	</div>


</footer>



</body>

</html>
